
x = 30

local function foo()
    print("in the function")
    --dosomething()
    print(x)
    local x = 10
    local y = 20
    print(x)
    return x + y
end

local a = foo    --把函数赋给变量

print(a())

--output:in the function 30